load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "util",
    srcs = [
        "byitem.go",
        "explain_misc.go",
        "expression.go",
        "funcdep_misc.go",
        "handle_cols.go",
        "misc.go",
        "null_misc.go",
        "path.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/planner/util",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/expression",
        "//pkg/kv",
        "//pkg/meta/model",
        "//pkg/parser/ast",
        "//pkg/parser/model",
        "//pkg/parser/mysql",
        "//pkg/planner/cascades/base",
        "//pkg/planner/core/base",
        "//pkg/planner/funcdep",
        "//pkg/planner/planctx",
        "//pkg/planner/property",
        "//pkg/sessionctx/stmtctx",
        "//pkg/tablecodec",
        "//pkg/types",
        "//pkg/util/chunk",
        "//pkg/util/codec",
        "//pkg/util/collate",
        "//pkg/util/hint",
        "//pkg/util/intset",
        "//pkg/util/ranger",
        "//pkg/util/size",
        "@com_github_pingcap_errors//:errors",
    ],
)

go_test(
    name = "util_test",
    timeout = "short",
    srcs = [
        "main_test.go",
        "path_test.go",
    ],
    embed = [":util"],
    flaky = True,
    deps = [
        "//pkg/domain",
        "//pkg/meta/model",
        "//pkg/planner/core",
        "//pkg/testkit/testsetup",
        "//pkg/types",
        "//pkg/util/collate",
        "//pkg/util/ranger",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_goleak//:goleak",
    ],
)
